package com.example.hyg_veintype.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.core.content.ContextCompat;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.example.hyg_veintype.R;
import com.example.hyg_veintype.activity.account.userCenter.UserCenterActivity;
import com.example.hyg_veintype.activity.bleList.ScanBLEListActivity;
import com.example.hyg_veintype.base.BaseVeinTypeActivity;
import com.hyg.lib_common.constant.Constants;


/**
 * @author: yyw
 * time: 2020/12/24 9:56
 * desc:主页
 */
@Route(path = Constants.PATH_ACTIVITY_MODULE_VEINTYPE_MAIN)
public class MainActivity extends BaseVeinTypeActivity {
    Button btStart;

    public static void start(Context context) {
        Intent starter = new Intent(context, MainActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.veintype_activity_main;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        tvTitle.setText("首页");
        lnTopLeft.setVisibility(View.GONE);
        lnTopRight.setVisibility(View.VISIBLE);
        imgRight.setImageDrawable(ContextCompat.getDrawable(this,R.drawable.veintype_ic_phone));
        btStart=findViewById(R.id.bt_start);
        btStart.setOnClickListener(this);
        lnTopRight.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.bt_start) {
            ScanBLEListActivity.start(MainActivity.this);
        } else if (id == R.id.ln_top_right) {
            UserCenterActivity.start(MainActivity.this);
        }
    }
}
